<?
/*----------------------------------------------------------------------
          (C) Bobtail-Bear 2006 	小飞熊新一代下载系统
          	代码编写：小飞熊	版权所有：小飞熊[L.F.Bear]
				官方网站/技术支持：http://www.lfbear.cn
------------------------------------------------------------------------
          (C) Bobtail-Bear 2006 	L.F.Bear's New Download Sysytem
          	Powered by L.F.Bear  Copyright L.F.Bear's Home(R)
               Official Web/Support：http://www.lfbear.cn
-----------------------------------------------------------------------*/

//本页脚本功能：软件浏览页面
$thispage="view.php";
$searchbar="y";
require("header.php"); 
$id=$_GET[id];
//防止恶意刷新代码
$timestamp=time();
$cookietime = $timestamp+3153600;
if ($REQUEST_URI == $_COOKIE['lastpath'] && ($timestamp-$_COOKIE['lastvisit']<$dis_reload) && $id==$_COOKIE['sid']) 
{
$fb_title1=$p_lang[23];
$fb_title2=$p_lang[24];
$fb_msg=$p_lang[25].$dis_reload.$p_lang[26]." !";
$fb_link="index.php";
require("feedback.php");
}
setcookie('lastpath', $REQUEST_URI, $cookietime);
setcookie('lastvisit', $timestamp, $cookietime);
setcookie('sid', $id, $cookietime);

//测试软件是否存在
$file_path=$path_soft."/".$id.".php";
$file_path_=$path_soft."/".$id.".kwd";
if(!file_exists($file_path))
{
$fb_title1=$p_lang[13];
$fb_title2=$p_lang[24];
$fb_msg=$p_lang[89];
$fb_link="index.php";
require("feedback.php");
}
else{//如果软件的确存在
$check_pre="r0a5n2d1_".$id;
if($safe=="y") {
$check_=mimi();
$check_info=$check_."_".$id;
setcookie("$check_pre","$check_info",time()+180);}//check_down($id);
else setcookie("$check_pre","",time()-3600);

//调入下载TOP10
$td10_info=@file("cache/top_soft.php");
$td_show="<table width=\"175\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"><tr><td>";

for($dn=0;$dn<count($td10_info);$dn++)
{
unset($tempy);
$tempy=explode("|",$td10_info[$dn]);
$td_show.="<li><a href=view.php?id=$tempy[0] title=\"$tempy[1]\"> $tempy[1] </a></li>";
}
if(count($td10_info)==0) $td_show.=$p_lang[1];

$td_show.="</td></tr></table>";
//调入推荐TOP10
$top10_info=@file("cache/recommend.php");
$top10_show="<table width=\"175\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"><tr><td>";
for($tn=0;$tn<count($top10_info);$tn++)
{
unset($temp);
$temp=explode("|",$top10_info[$tn]);
$top10_show.="<li><a href=view.php?id=$temp[0] title=\"$temp[1]\"> $temp[1] </a></li>";
}
if(count($top10_info)==0) $top10_show.=$p_lang[1];
$top10_show.="</td></tr></table>";

//调入软件信息
$sof_info=readf($file_path);
$sof_info=explode("|",$sof_info);
showclassname($sof_info[6],$sof_info[7]);

if($sof_info[3]=="" || $sof_info[3]==$p_lang[0] || $sof_info[1]==-1)
{
$fb_title1=$p_lang[13];
$fb_title2=$p_lang[24];
$fb_msg=$p_lang[89];
$fb_link="index.php";
require("feedback.php");
}
if(file_exists($file_path_))
{
$sof_info_=readf($file_path_);
$sof_info_=explode("|",$sof_info_);
$sof_info_=explode(",",$sof_info_[1]);
}
}
//用户登陆
if($users=="n")
{
$div=f_l_list(2);
$skip=1;
}
if($skip!=1 && $_SESSION[f_login]=="yes" && $_COOKIE[l_state]=="ok")
$div=f_l_list(1);
elseif($skip!=1 && ($_SESSION[f_login]!="yes" || $_COOKIE[l_state]!="ok"))
$div=f_l_list(0);
//为输出数据准备
$date=str_replace("-","",$sof_info[5]);
$limit=timeout($date,$sof_info[2]);
if($limit!=0 && $sof_info[1]==1) 
{$t_msg[1]=$p_lang[90];$down=1;}
elseif ($sof_info[1]==0 || $sof_info[1]==-1)
{$t_msg[1]=$p_lang[91];$down=0;}
elseif ($limit==0)
{$t_msg[1]=$p_lang[92];$down=0;}

if($limit>0) $t_msg[2]=$p_lang[93].$limit.$p_lang[94];

$t_msg[3]=choose_pre_dem($sof_info[15],$sof_info[16]);

$kwd_num=count($sof_info_);
for($k=0;$k<$kwd_num;$k++){
$t_msg[4]="<a href=search.php?whatis=$sof_info_[$k] target=\"_blank\" title=$p_lang[95] >".$sof_info_[$k]."</a>&nbsp;";}

$cfile_path1=$path_soft."/click/".$id.".brt";
if(!file_exists($cfile_path1)) {$t_msg[5]=0;writef($cfile_path1,"1","w");}
else {$brt=readf($cfile_path1); $t_msg[5]=$brt;$brt++;writef($cfile_path1,$brt,"w");}

$cfile_path2=$path_soft."/click/".$id.".dnt";
if(!file_exists($cfile_path2)) $t_msg[6]=0;else {$brt=readf($cfile_path2);$t_msg[6]= $brt;}

if($sof_info[17]=="0" && $sof_info[18]=="0") $t_msg[7]=$p_lang[96];
elseif($sof_info[17]=="0" && $sof_info[18]!="0") $t_msg[7]="<a href=mailto:$sof_info[18]>$sof_info[18]</a>";
elseif($sof_info[17]!="0" && $sof_info[18]=="0") $t_msg[7]="$sof_info[17]";
else $t_msg[7]="<a href=mailto:$sof_info[18]>$sof_info[17]</a>";

if($sof_info[19]=="0" && $sof_info[20]=="0") $t_msg[8]=$p_lang[97];
elseif($sof_info[19]=="0" && $sof_info[20]!="0") $t_msg[8]="<a href=$sof_info[20] target=\"_blank\">$sof_info[20]</a>";
elseif($sof_info[19]!="0" && $sof_info[20]=="0") $t_msg[8]="$sof_info[19]";
else  $t_msg[8]="<a href=$sof_info[20] target=\"_blank\">$sof_info[19]</a>";

$t_msg[9]=view_ad($sof_info[21]);

$t_msg[10]=readf("include/announce.php");

if($down==1)
{
for($x=28,$i=2;$x<=40;$x+=4,$i++){ 
if($sof_info[$x]!="0") $down_show.="&nbsp;&nbsp;<a href=downfile.php?id=$id&link=$i title='".$p_lang[98].$sof_info[$x+3].$p_lang[99]."'>". $sof_info[$x+1]."[".$sof_info[$x+3]."]</a>";
}
$t_msg[11]=$p_lang[105]."&nbsp;&nbsp;<a href=downfile.php?id=$id&link=1 title='".$p_lang[98].$sof_info[27].$p_lang[99]."'>$sof_info[25] [$sof_info[27]]</a>
$down_show ";
}
else $t_msg[11]=$p_lang[100];

if($sof_info[44]==0) $t_msg[12]=$p_lang[101];
else $more_soft=explode(",",$sof_info[44]);
$m_soft_num=count($more_soft);
for($m=0;$m<$m_soft_num;$m++)
{
$file_path_1=$path_soft."/".$more_soft[$m].".kwd";
//echo $file_path_1;
if(file_exists($file_path_1)){
$m_soft_n=readf($file_path_1);
$m_soft_n=explode("|",$m_soft_n);
$t_msg[12].="<a href=view.php?id=$more_soft[$m] target=\"_blank\">$m_soft_n[0]</a><br>";
}}


if($sof_info[45]==0) $t_msg[13]=$p_lang[102];
else $more_soft=explode(",",$sof_info[45]);
$m_soft_num=count($more_soft);
for($m=0;$m<$m_soft_num;$m++)
{
$file_path_1=$path_news."/".$more_soft[$m].".php";
if(file_exists($file_path_1)){
$m_soft_n=readf($file_path_1);
$m_soft_n=explode("|",$m_soft_n);
$t_msg[13].="<a href=news.php?id=$more_soft[$m] target=\"_blank\">[$m_soft_n[4]] $m_soft_n[3]</a><br>";
}}

if(file_exists($path_soft."/".$id.".mak"))
{
$mark_info=readf($path_soft."/".$id.".mak");
$mark_info=explode("|",$mark_info);
for($i=0;$i<=3;$i++)
if($mark_info[$i]=="") $mark_info[$i]=0;
$t_msg[14]=$p_lang[103].$mark_info[0].$p_lang[87]." ".$t_lang[73].":".$mark_info[1].$t_lang[10].";".$t_lang[74].":".$mark_info[2].$t_lang[10].";".$t_lang[75].":".$mark_info[3].$t_lang[10];
				}
else $t_msg[14]=$p_lang[104];

$t_msg[15]=view_ad($sof_info[22],0);

//输出到模版
require("include/template.php");
$imagepath="template/".$t_path."/images";
	require("template.php");
	$page = new SmartTemplate( "view.html" );
	$page->assign('div',$div);
	$page->assign('sof_info',$sof_info);
	$page->assign('top10_show',$top10_show);
	$page->assign('td_show',$td_show);
	$page->assign('classname',$classname);
	$page->assign('t_msg',$t_msg);
	$page->assign('pic_http',$pic_http);
	$page->assign('imagepath',$imagepath);
	$page->assign('id',$id);
	$page->assign('t_lang',$t_lang);
	$page->assign('common',$common);
	$page->output();
require("footer.php");
die(); 
?>